﻿public class ApiResultUtils
{
    public static ApiResult<T> Success<T>(T data, string message = "操作成功")
    {
        return new ApiResult<T>
        {
            Code = 0,
            Success = true,
            Data = data,
            Message = message
        };
    }

    public static ApiResult Success(string message = "操作成功")
    {
        return new ApiResult
        {
            Code = 0,
            Success = true,
            Data = null,
            Message = message
        };
    }

    public static ApiResult<T> Fail<T>(T data, string message = "操作失败")
    {
        return new ApiResult<T>
        {
            Code = 500,
            Success = false,
            Data = data,
            Message = message
        };
    }

    public static ApiResult Fail(string message = "操作失败")
    {
        return new ApiResult
        {
            Code = 500,
            Success = false,
            Data = null,
            Message = message
        };
    }
}
